package com.smile.ye.http;

import com.smile.ye.data.dto.StaffCreateDto;
import com.smile.ye.data.dto.StaffQueryDto;
import com.smile.ye.data.dto.StaffUpdateDto;
import com.smile.ye.response.Result;
import com.smile.ye.service.StaffService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/staffs")
@Api("员工")
public class StaffController {
    @Autowired
    StaffService service;

    @GetMapping
    @ApiOperation("分页查询")
    public Result query(StaffQueryDto dto){
        return  service.query(dto);
    }
    @PostMapping
    @ApiOperation("新增")
    public Result create(@RequestBody StaffCreateDto dto){
        return service.create(dto);
    }
    @PutMapping("/{id}")
    @ApiOperation("修改")
    public Result update(@PathVariable String id ,@RequestBody StaffUpdateDto dto){
        return service.update(id,dto);
    }
    @PostMapping("/{id}")
    @ApiOperation("删除")
    public Result remove(@PathVariable String id){
        return service.remove(id);
    }

}
